@extends('admin.main')

@section('body')
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>行为列表</h2>
	</div>

    <div>
        <button class="btn" id="action_add" url="{{urlAdmin('action','getAdd')}}">新 增</button>
        <button class="btn ajax-post" target-form="ids" url="{{urlAdmin('action','anySetStatus',['status'=>1])}}" >启 用</button>
        <button class="btn ajax-post" target-form="ids" url="{{urlAdmin('action','anySetStatus',['status'=>0])}}">禁 用</button>
        <button class="btn ajax-post confirm" target-form="ids" url="{{urlAdmin('action','anySetStatus',['status'=>-1])}}">删 除</button>
    </div>
	<!-- 数据列表 -->
	<div class="data-table">
<table class="">
    <thead>
        <tr>
		<th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
		<th class="">编号</th>
		<th class="">标识</th>
		<th class="">名称</th>
		<th class="">类型</th>
		<th class="">规则</th>
		<th class="">状态</th>
		<th class="">操作</th>
		</tr>
    </thead>
    <tbody>
	@if(count($rows['data']))
		@foreach($rows['data'] as $v)
		<tr>
            <td><input class="ids" type="checkbox" name="ids[]" value="{{$v['id']}}" /></td>
			<td>{{$v['id']}}</td>
			<td>{{$v['name']}}</td>
			<td><a href="{{urlAdmin('action','getEdit',['id'=>$v['id']])}}">{{$v['title']}}</a></td>
			<td><span>{{get_action_type($v['type'])}}</span></td>
			<td>{{$v['remark']}}</td>
			<td>{{$v['status_text']}}</td>
			<td><a href="{{urlAdmin('action','getEdit',['id'=>$v['id']])}}">编辑</a>
				<a href="{{urlAdmin('action','anySetStatus',['ids'=>$v['id'],'status'=>abs(1-$v['status'])])}}" class="ajax-get">{{show_status_op($v['status'])}}</a>
				<a href="{{urlAdmin('action','anySetStatus',['ids'=>$v['id'],'status'=>-1])}}" class="confirm ajax-get">删除</a>
                </td>
		</tr>
		@endforeach
	@else
		<td colspan="8" class="text-center">aOh! 暂时还没有内容!</td>
	@endif
	</tbody>
    </table>

	</div>
	<!-- 分页 -->
	<div class="page">
		@if($rows['last_page']>1)
			<div>
				@if($rows['prev_page_url'])
					<a class="prev" href="{{$rows['prev_page_url']}}">&lt;&lt;</a>
				@endif
				@if(count($rows['pageNoList']))
					@foreach($rows['pageNoList'] as $v)
						@if($rows['current_page'] == $v)
							<span class="current">{{$v}}</span>
						@else
							<a class="num" href="{{urlAdmin('action','getIndex',['page'=>$v])}}">{{$v}}</a>
						@endif
					@endforeach
				@endif
				@if($rows['next_page_url'])
					<a class="next" href="{{$rows['next_page_url']}}">&gt;&gt;</a>
				@endif
				<span class="rows">共 {{$rows['total']}} 条记录</span>
			</div>
		@endif
	</div>
	<!-- /分页 -->

@endsection

@section('script')
<script type="text/javascript">
$(function(){
	$("#action_add").click(function(){
		window.location.href = $(this).attr('url');
	})
})
</script>
@endsection
